package com.zhaokuner.parentstarter.config;

import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import java.util.HashSet;
import java.util.Set;

/**
 * <p>
 * Description:获取资源文件
 * <p>
 * Copyright: 天津联想协同科技有限公司
 * <p>
 *
 * @author 赵希坤 zhaoxikun
 * @date 2021/5/28 10:02 上午
 * @see org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration
 */
@ConfigurationProperties(prefix = "spring.messages")
@Configuration
@Primary
public class MyMessageSourceProperties extends org.springframework.boot.autoconfigure.context.MessageSourceProperties {

    private Set<String> lenovoSet = new HashSet<>();

    @Override
    public String getBasename() {
        return StringUtils.join(lenovoSet, ",");
    }

    @Override
    public void setBasename(String basename) {
        lenovoSet.add(basename);
    }

    public Set<String> getLenovoSet() {
        return lenovoSet;
    }

    public void setLenovoSet(Set<String> lenovoSet) {
        this.lenovoSet.addAll(lenovoSet);
    }
}
